<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function Phone(name, price) {
      this.name = name
      this.price = price
    }
    function XiaoMI(name, price) {
      // 构造函数继承 this是他的实例化对象
      Phone.call(this, name, price)
    }
    // 原型链继承(不能直接把父类的原型对象赋值给子类的原型对象,否则会共享)
    XiaoMI.prototype = new Phone
    // 修正constructor
    XiaoMI.prototype.constructor = XiaoMI
    var newPhone = new XiaoMI('11', 4999)
    console.log(newPhone);
  </script>
</body>

</html>